package test1;

import java.util.Random;

public class geDou {
    private String name;
    private int  blood;
    private char gender;
    private String face;
    String[] boyFaces={"风流俊雅","相貌英俊","相貌平平"};

    String[] girlFaces={"沉鱼落雁","小鸟依人","相貌平平"};
    String[] gongJi={"%s大喊一声,身体下伏,锤向%s的大腿","%s运气与掌,一瞬间手掌通红,将%s打到在地"};
    public geDou() {
    }

    public geDou(String name, int blood,char gender){
        this.name = name;
        this.blood = blood;
        this.gender=gender;
        setFace(gender);

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }


    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    public void setFace(char gender) {
        Random r=new Random();
        if(gender=='男'){
            int index=r.nextInt(boyFaces.length);
            this.face=boyFaces[index];
        }else{
            int index=r.nextInt(girlFaces.length);
            this.face=girlFaces[index];
        }
    }
    public String getFace() {
        return face;
    }
    public void attack(geDou role){
        Random r=new Random();
        //打的姿势
        int index=r.nextInt(gongJi.length);
        String kungFu=gongJi[index];
        System.out.printf(kungFu,this.getName(),role.getName());
        //打的过程
        int hurt=r.nextInt(20)+1;
        int remainBlood=role.getBlood()-hurt;
        remainBlood=remainBlood<0? 0:remainBlood;
        role.setBlood(remainBlood);
        System.out.println(",造成了"+hurt+
                "下伤害,"+"最终"+role.getName()+"剩余血的点数为"+remainBlood);
    }




}
